package control

import (
	"FlyFight/Internal/auth"
	"log"

	"github.com/gin-gonic/gin"
)




func Login(c *gin.Context) { 
	var l login
	if err := c.ShouldBindJSON(&l); err != nil {
		c.JSON(200, gin.H{
			"code": 200,
			"msg": "error",
		})
		return
	}
	token,err:=auth.Login(l.Usrname,l.Pass)
	if err!=nil{
		log.Println(err)
		c.JSON(200, gin.H{
			"code": 200,
			"msg": "error",
		})
		return
	}
	c.JSON(200, gin.H{
		"code": 200,
		"msg": "ok",
		"token": token,
	})

	
}

